import 'package:distribution_mall_flutter/generated/json/base/json_convert_content.dart';
import 'package:distribution_mall_flutter/entity/order/order.dart';

OrderCreateEntity $OrderCreateEntityFromJson(Map<String, dynamic> json) {
  final OrderCreateEntity orderCreateEntity = OrderCreateEntity();
  final String? distributionOrderId = jsonConvert.convert<String>(
      json['distributionOrderId']);
  if (distributionOrderId != null) {
    orderCreateEntity.distributionOrderId = distributionOrderId;
  }
  final String? channelOrderNo = jsonConvert.convert<String>(
      json['channelOrderNo']);
  if (channelOrderNo != null) {
    orderCreateEntity.channelOrderNo = channelOrderNo;
  }
  final String? receiptPaymentId = jsonConvert.convert<String>(
      json['receiptPaymentId']);
  if (receiptPaymentId != null) {
    orderCreateEntity.receiptPaymentId = receiptPaymentId;
  }
  final String? state = jsonConvert.convert<String>(json['state']);
  if (state != null) {
    orderCreateEntity.state = state;
  }
  final double? goodsTotalAmount = jsonConvert.convert<double>(
      json['goodsTotalAmount']);
  if (goodsTotalAmount != null) {
    orderCreateEntity.goodsTotalAmount = goodsTotalAmount;
  }
  final double? totalAmount = jsonConvert.convert<double>(json['totalAmount']);
  if (totalAmount != null) {
    orderCreateEntity.totalAmount = totalAmount;
  }
  final int? paymentDeadline = jsonConvert.convert<int>(
      json['paymentDeadline']);
  if (paymentDeadline != null) {
    orderCreateEntity.paymentDeadline = paymentDeadline;
  }
  return orderCreateEntity;
}

Map<String, dynamic> $OrderCreateEntityToJson(OrderCreateEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['distributionOrderId'] = entity.distributionOrderId;
  data['channelOrderNo'] = entity.channelOrderNo;
  data['receiptPaymentId'] = entity.receiptPaymentId;
  data['state'] = entity.state;
  data['goodsTotalAmount'] = entity.goodsTotalAmount;
  data['totalAmount'] = entity.totalAmount;
  data['paymentDeadline'] = entity.paymentDeadline;
  return data;
}

extension OrderCreateEntityExtension on OrderCreateEntity {
  OrderCreateEntity copyWith({
    String? distributionOrderId,
    String? channelOrderNo,
    String? receiptPaymentId,
    String? state,
    double? goodsTotalAmount,
    double? totalAmount,
    int? paymentDeadline,
  }) {
    return OrderCreateEntity()
      ..distributionOrderId = distributionOrderId ?? this.distributionOrderId
      ..channelOrderNo = channelOrderNo ?? this.channelOrderNo
      ..receiptPaymentId = receiptPaymentId ?? this.receiptPaymentId
      ..state = state ?? this.state
      ..goodsTotalAmount = goodsTotalAmount ?? this.goodsTotalAmount
      ..totalAmount = totalAmount ?? this.totalAmount
      ..paymentDeadline = paymentDeadline ?? this.paymentDeadline;
  }
}

OrderTransportEntity $OrderTransportEntityFromJson(Map<String, dynamic> json) {
  final OrderTransportEntity orderTransportEntity = OrderTransportEntity();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    orderTransportEntity.code = code;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    orderTransportEntity.name = name;
  }
  final String? desc = jsonConvert.convert<String>(json['desc']);
  if (desc != null) {
    orderTransportEntity.desc = desc;
  }
  final int? minDay = jsonConvert.convert<int>(json['minDay']);
  if (minDay != null) {
    orderTransportEntity.minDay = minDay;
  }
  final int? maxDay = jsonConvert.convert<int>(json['maxDay']);
  if (maxDay != null) {
    orderTransportEntity.maxDay = maxDay;
  }
  final int? estimateMinDay = jsonConvert.convert<int>(json['estimateMinDay']);
  if (estimateMinDay != null) {
    orderTransportEntity.estimateMinDay = estimateMinDay;
  }
  final int? estimateMaxDay = jsonConvert.convert<int>(json['estimateMaxDay']);
  if (estimateMaxDay != null) {
    orderTransportEntity.estimateMaxDay = estimateMaxDay;
  }
  final bool? isDisplay = jsonConvert.convert<bool>(json['isDisplay']);
  if (isDisplay != null) {
    orderTransportEntity.isDisplay = isDisplay;
  }
  final bool? isIncludeShipFee = jsonConvert.convert<bool>(
      json['isIncludeShipFee']);
  if (isIncludeShipFee != null) {
    orderTransportEntity.isIncludeShipFee = isIncludeShipFee;
  }
  return orderTransportEntity;
}

Map<String, dynamic> $OrderTransportEntityToJson(OrderTransportEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['name'] = entity.name;
  data['desc'] = entity.desc;
  data['minDay'] = entity.minDay;
  data['maxDay'] = entity.maxDay;
  data['estimateMinDay'] = entity.estimateMinDay;
  data['estimateMaxDay'] = entity.estimateMaxDay;
  data['isDisplay'] = entity.isDisplay;
  data['isIncludeShipFee'] = entity.isIncludeShipFee;
  return data;
}

extension OrderTransportEntityExtension on OrderTransportEntity {
  OrderTransportEntity copyWith({
    String? code,
    String? name,
    String? desc,
    int? minDay,
    int? maxDay,
    int? estimateMinDay,
    int? estimateMaxDay,
    bool? isDisplay,
    bool? isIncludeShipFee,
  }) {
    return OrderTransportEntity()
      ..code = code ?? this.code
      ..name = name ?? this.name
      ..desc = desc ?? this.desc
      ..minDay = minDay ?? this.minDay
      ..maxDay = maxDay ?? this.maxDay
      ..estimateMinDay = estimateMinDay ?? this.estimateMinDay
      ..estimateMaxDay = estimateMaxDay ?? this.estimateMaxDay
      ..isDisplay = isDisplay ?? this.isDisplay
      ..isIncludeShipFee = isIncludeShipFee ?? this.isIncludeShipFee;
  }
}

SaleReasonEntity $SaleReasonEntityFromJson(Map<String, dynamic> json) {
  final SaleReasonEntity saleReasonEntity = SaleReasonEntity();
  final String? reasonId = jsonConvert.convert<String>(json['reasonId']);
  if (reasonId != null) {
    saleReasonEntity.reasonId = reasonId;
  }
  final String? reasonCn = jsonConvert.convert<String>(json['reasonCn']);
  if (reasonCn != null) {
    saleReasonEntity.reasonCn = reasonCn;
  }
  final String? reasonEn = jsonConvert.convert<String>(json['reasonEn']);
  if (reasonEn != null) {
    saleReasonEntity.reasonEn = reasonEn;
  }
  return saleReasonEntity;
}

Map<String, dynamic> $SaleReasonEntityToJson(SaleReasonEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['reasonId'] = entity.reasonId;
  data['reasonCn'] = entity.reasonCn;
  data['reasonEn'] = entity.reasonEn;
  return data;
}

extension SaleReasonEntityExtension on SaleReasonEntity {
  SaleReasonEntity copyWith({
    String? reasonId,
    String? reasonCn,
    String? reasonEn,
  }) {
    return SaleReasonEntity()
      ..reasonId = reasonId ?? this.reasonId
      ..reasonCn = reasonCn ?? this.reasonCn
      ..reasonEn = reasonEn ?? this.reasonEn;
  }
}